
<html> 
    <head>
        <link href="style3.css" rel="stylesheet" type="text/css" />
    </head> 
</html>

<?php
//starting the session to get the id of the current user 
session_start();
//establishing  a database connection
$conn = @mysql_connect("localhost", "root", "") or die(mysql_error());
mysql_select_db("mydb") or die(mysql_error());

//getting the id of the current member
$member_id= $_SESSION['member_id'];
include 'viewnewmessages.php';



//execute query to display the conferences of this user and his role in each conference 
$result = mysql_query("SELECT c.long_name,m.member_id , p.role , m.conference_id 
                 FROM  Conference c , member_privileges m  , Privileges p 
                 WHERE m.member_id =  '$member_id' AND c.conference_id= m.conference_id  
				 AND p.privileges_id = m.privileges_id;")
        or die(mysql_error());

echo '<table width="70%">
                <tr>
                    <td><b>Conference</b></td>
					 <td><b>Role</b></td>
                </tr>';
//printing each value 
while ($row = mysql_fetch_assoc($result)) {
if( $row['role'] == "attendee")
{

//printing the long name of the conference , the user's role and a "go to the conference button " that redirects to subscriber conference page where the user can see all this information in this specific conference 
    echo "
                <tr>
				<td>{$row['long_name']}</td> 
				<td>{$row['role']} </td> 
				<td><a href='ConferencePage.php?conference_id={$row['conference_id']}'>go to Conference</a </td> 
				  </tr>";
}
else 
{
    echo "
                <tr>
				<td>{$row['long_name']}</td> 
				<td>{$row['role']} </td> 
				<td><a href='subscriberConferencePage.php?conference_id={$row['conference_id']}&role={$row['role']}'>go to Conference</a </td> 
				  </tr>";
				  }
				  }
                                     return viewnewmessages($member_id);
?>				  
</body>
</html>

